#include "brush.h"

Brush::Brush(QGraphicsItem *p) :
    QGraphicsWidget(p)
{
    penColor.setRgb( 255.0, 255.0, 255.0, 255.0 );
    brushColor.setRgb( 255.0, 255.0, 255.0, 100.0 );

    width = 0;
    height = 0;
}

///SETTERS

void Brush::setWidth(float newWidth)
{
    width = newWidth;
}

void Brush::setHeight(float newHeight)
{
    height = newHeight;
}

/////END SETTERS
/////PAINT FUNCTIONS///////
QRectF Brush::boundingRect() const
{
    return QRectF(0, 0, width, height);
}

QPainterPath Brush::shape() const
{
    QPainterPath path;
    path.addRect(boundingRect());
    return path;
}


void Brush::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    QRectF bRect = boundingRect();

    painter->setRenderHint(QPainter::Antialiasing);

    painter->setBrush(brushColor);
    painter->setPen( penColor);
    painter->drawRect(bRect);

}

//////PAINT FUNCTIONS///////////
